package xin.mashibo.pattern.interpreter;

import java.io.*;

/**
 * @author MaShibo
 * 日期 :  2019/1/29
 */
public class Main {

    public static void main(String[] args) {
        try {
            try (BufferedReader reader =
                         new BufferedReader(new InputStreamReader(new FileInputStream("program.txt"), "UTF-8"))) {
                String text;
                while ((text = reader.readLine()) != null) {
                    System.out.println("text = \"" + text + "\"");
                    Node node = new ProgramNode();
                    node.parse(new Context(text));
                    System.out.println("node = " + node);
                }
            }
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
